Following on from analyzing DNS traffic for threat detection, the next focus is HTTP—another core element of internet communication. Why DNS and HTTP? Imagine trying to navigate the web without them; it’s nearly impossible. HTTP, the protocol enabling communication between web browsers and servers, is everywhere, especially in web applications, And web applications are everywhere :D. making it a valuable source for network security monitoring.
This article provides an in-depth exploration of using HTTP traffic to detect malicious activity, presenting a variety of techniques and real-world examples to help you defend your environment proactively.
Given its prevalence, HTTP traffic serves as a treasure trove for security monitoring. Many cyberattacks leverage HTTP in some form, allowing malicious actors to blend in with normal traffic while compromising systems and exfiltrating data. By scrutinizing HTTP traffic, we can identify unusual patterns and respond to threats promptly.
HTTP analysis can reveal both inbound attacks (originating from external sources) and outbound threats (potential malicious behavior from within the network). Identifying the direction of the traffic is critical in understanding intent and tailoring defenses.
Inbound HTTP threats often include attacks such as:
Outbound HTTP traffic might reveal:
To effectively monitor HTTP traffic, it’s essential to gather logs from different sources, depending on whether you’re analyzing inbound or outbound traffic:
X-Forwarded-For
field to identify the original source IP.HTTP logs can be massive and overwhelming in their raw form. To turn this data into actionable insights, log enrichment techniques are key:
freq.py
: Utilize tools like Mark Baggett’s freq.py
to detect randomly generated or obfuscated strings. This is useful for identifying Domain Generation Algorithms (DGAs) or unusual User-Agent strings in HTTP requests.
freq.py
flagged requests to randomly generated domains, pointing to a DGA-based malware infection.Here are some key techniques for identifying malicious HTTP activity, supported by slingshot THM's room scenarios:
404 Not Found
errors often points to vulnerability scanning or directory traversal attempts.404
errors in 30 minutes revealed a vulnerability scanner probing common attack paths, like /ad8min
and /cgi-bin
.200 OK
responses, especially paired with large data transfers, may signal exfiltration or successful brute-force attempts.200 OK
responses with over 1GB of transferred data from an internal IP indicated unauthorized data exfiltration.here you can dominant count of 200 responses by 10.0.2.15
Analyzing HTTP traffic is fundamental for detecting and countering a range of malicious activities. By enriching HTTP logs and applying these detection methods, you can gain deep insights into your network activity and proactively safeguard your environment. Remember, security is an evolving process—continue refining and adapting your monitoring techniques to stay ahead of ever-evolving threats.